package cate.game.role.res.hero.reborn;

import cate.common.table.d.GDHero;
import cate.game.role.RoleDependent;
import cate.game.train.hero.msg.HeroRebornDataResp;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;

@NoteClass(value = "英雄重生数据")
public class HeroReborn extends RoleDependent {
    @NoteField(value = "今日已重生次数")
    public int rebornTime;

    @Override
    public void onDaySpan(boolean silence){
        rebornTime = 0;
        if(!silence){
            noticeUpdate();
        }
    }

    public void reborn(){
        rebornTime++;
        noticeUpdate();
    }

    public boolean canReborn() {
        return rebornTime < GDHero.Reborn.FREE_TIMES;
    }

    public void noticeUpdate(){
        role.sendNow(new HeroRebornDataResp(this));
    }
}
